//
//  PCDApiGetClipboardData.m
//  PCDMPaasBank
//
//  Created by DK on 2021/3/9.
//  Copyright © 2021 Alibaba. All rights reserved.
//

#import "PCDApiGetClipboardData.h"

@implementation PCDApiGetClipboardData

- (void)handler:(id)data andContext:(PCDContext *)context ResponseCallback:(WVJBResponseCallback )responseCallback
{
    
    NSString *callBack = [data objectForKey:@"success"];
    
    UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
    NSString *clipboardData = pasteboard.string;
    NSDictionary *clipboardDataDict = @{@"data":[PCDUtil safeString:clipboardData],@"_callbackName":@"success"};
    
    
    if (![PCDUtil nilOrEmptyString:callBack]) {
        //
        evaluateJavaScriptOnMainThread(self,callBack,[clipboardDataDict JSONRepresentation]);
    }
}

@end
